<HTML>
<HEAD>
  <TITLE> DwBodyPart Man Page </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>
  <FONT COLOR="navy"> NAME </FONT>
</H2>
<P>
DwBodyPart -- Class representing a MIME body-part
<H2>
  <FONT COLOR="navy"> SYNOPSIS </FONT>
</H2>
<PRE>class DW_EXPORT DwBodyPart : public <A HREF="entity.html">DwEntity</A> {

public:

    <A HREF="bodypart.html#DwBodyPart">DwBodyPart</A>();
    <A HREF="bodypart.html#DwBodyPart">DwBodyPart</A>(const DwBodyPart&amp; aPart);
    <A HREF="bodypart.html#DwBodyPart">DwBodyPart</A>(const DwString&amp; aStr, DwMessageComponent* aParent=0);
    virtual ~DwBodyPart();
    const DwBodyPart&amp; <A HREF="bodypart.html#op_eq">operator =</A> (const DwBodyPart&amp; aPart);
    virtual DwMessageComponent* <A HREF="bodypart.html#Clone">Clone</A>() const;
    static DwBodyPart* <A HREF="bodypart.html#NewBodyPart">NewBodyPart</A>(const DwString&amp; aStr,
        DwMessageComponent* aParent);
    DwBodyPart* <A HREF="bodypart.html#Next">Next</A>() const;
    void <A HREF="bodypart.html#SetNext">SetNext</A>(const DwBodyPart* aPart);
    static DwBodyPart* (*<A HREF="bodypart.html#sNewBodyPart">sNewBodyPart</A>)(const DwString&amp;, DwMessageComponent*);

public:

    virtual void <A HREF="bodypart.html#PrintDebugInfo">PrintDebugInfo</A>(ostream&amp; aStrm, int aDepth=0) const;
    virtual void <A HREF="bodypart.html#CheckInvariants">CheckInvariants</A>() const;

protected:

    void _PrintDebugInfo(ostream&amp; aStrm) const;
};
</PRE>
<H2>
  <FONT COLOR="navy"> DESCRIPTION </FONT>
</H2>
<P>
<B><TT>DwBodyPart</TT></B> represents a <I>body part</I>, as described in
RFC-2045 and RFC-2046. A body part is an <I>entity</I>, so it has a collection
of headers and a <I>body</I>. A body part is different from a <I>message</I>
in that a body part is part of a multipart body.
<P>
In MIME++, a <B><TT>DwBodyPart</TT></B> is a subclass of
<B><TT><A HREF="entity.html">DwEntity</A></TT></B>; therefore, it contains
both a <B><TT><A HREF="headers.html">DwHeaders</A></TT></B> object and a
<B><TT><A HREF="body.html">DwBody</A></TT></B> object, and it is contained
in a multipart <B><TT>DwBody</TT></B> object.
<P>
As with <B><TT><A HREF="message.html">DwMessage</A></TT></B>, most of the
functionality of <B><TT>DwBodyPart</TT></B> is implemented by the abstract
class <B><TT>DwEntity</TT></B>.
<H2>
  <FONT COLOR="navy"> Public Member Functions </FONT>
</H2>
<P>
<FONT COLOR="teal"><B> <A NAME="DwBodyPart">DwBodyPart</A>() <BR>
DwBodyPart(const DwBodyPart&amp; aPart) <BR>
DwBodyPart(const DwString&amp; aStr, DwMessageComponent* aParent=0)
</B></FONT>
<P>
The first constructor is the default constructor, which sets the
<B><TT>DwBodyPart</TT></B> object's string representation to the empty string
and sets its parent to <B><TT>NULL</TT></B>.
<P>
The second constructor is the copy constructor, which performs a deep copy
of <B><TT>aPart</TT></B>. The parent of the new
<B><TT>DwBodyPart</TT></B> object is set to <B><TT>NULL</TT></B>.
<P>
The third constructor copies <B><TT>aStr</TT></B> to the
<B><TT>DwBodyPart</TT></B> object's string representation and sets
<B><TT>aParent</TT></B> as its parent. The virtual member function
<B><TT>Parse()</TT></B> should be called immediately after this constructor
in order to parse the string representation. Unless it is
<B><TT>NULL</TT></B>, <B><TT>aParent</TT></B> should point to an object of
a class derived from <B><TT>DwBody</TT></B>.
<P>
<FONT COLOR="teal"><B> const DwBodyPart&amp; <A NAME="op_eq">operator =</A>
(const DwBodyPart&amp; aPart) </B></FONT>
<P>
This is the assignment operator, which performs a deep copy of
<B><TT>aPart</TT></B>. The parent node of the <B><TT>DwBodyPart</TT></B>
object is not changed.
<P>
<FONT COLOR="teal"><B> virtual DwMessageComponent*
<A NAME="Clone">Clone</A>() const </B></FONT>
<P>
This virtual function, inherited from <B><TT>DwMessageComponent</TT></B>,
creates a new <B><TT>DwBodyPart</TT></B> on the free store that has the same
value as this <B><TT>DwBodyPart</TT></B> object. The basic idea is that of
a virtual copy constructor.
<P>
<FONT COLOR="teal"><B> static DwBodyPart*
<A NAME="NewBodyPart">NewBodyPart</A>(const DwString&amp; aStr,
DwMessageComponent* aParent) </B></FONT>
<P>
Creates a new <B><TT>DwBodyPart</TT></B> on the free store. If the static
data member <B><TT>sNewBodyPart</TT></B> is <B><TT>NULL</TT></B>, this member
function will create a new <B><TT>DwBodyPart</TT></B> and return it. Otherwise,
<B><TT>NewBodyPart()</TT></B> will call the user-supplied function pointed
to by <B><TT>sNewBodyPart</TT></B>, which is assumed to return an object
from a class derived from <B><TT>DwBodyPart</TT></B>, and return that object.
<P>
<FONT COLOR="teal"><B> DwBodyPart* <A NAME="Next">Next</A>() const
</B></FONT>
<P>
This member function returns the next <B><TT>DwBodyPart</TT></B> object following
this <B><TT>DwBodyPart</TT></B> in the list of <B><TT>DwBodyPart</TT></B>
objects contained in a multipart <B><TT>DwBody</TT></B>.
<P>
<FONT COLOR="teal"><B> void <A NAME="SetNext">SetNext</A>(const DwBodyPart*
aPart) </B></FONT>
<P>
This advanced function sets <B><TT>aPart</TT></B> as the next
<B><TT>DwBodyPart</TT></B> object following this
<B><TT>DwBodyPart</TT></B> in the list of <B><TT>DwBodyPart</TT></B> objects
contained in a multipart <B><TT>DwBody</TT></B>. Since
<B><TT>DwBody</TT></B> contains a member function for adding a
<B><TT>DwBodyPart</TT></B> object to its list, this function should be avoided
for most applications.
<P>
<FONT COLOR="teal"><B> virtual void
<A NAME="PrintDebugInfo">PrintDebugInfo</A>(ostream&amp; aStrm, int aDepth=0)
const </B></FONT>
<P>
This virtual function, inherited from <B><TT>DwMessageComponent</TT></B>,
prints debugging information about this object to <B><TT>aStrm</TT></B>.
It will also call <B><TT>PrintDebugInfo()</TT></B> for any of its child
components down to a level of <B><TT>aDepth</TT></B>.
<P>
This member function is available only in the debug version of the library.
<P>
<FONT COLOR="teal"><B> virtual void
<A NAME="CheckInvariants">CheckInvariants</A>() const </B></FONT>
<P>
Aborts if one of the invariants of the object fails. Use this member function
to track down bugs.
<P>
This member function is available only in the debug version of the library.
<H2>
  <FONT COLOR="navy"> Public Data Members </FONT>
</H2>
<P>
<FONT COLOR="teal"><B> static DwBodyPart*
(*<A NAME="sNewBodyPart">sNewBodyPart</A>)(const DwString&amp;,
DwMessageComponent*) </B></FONT>
<P>
If <B><TT>sNewBodyPart</TT></B> is not <B><TT>NULL</TT></B>, it is assumed
to point to a user-supplied function that returns an object from a class
derived from <B><TT>DwBodyPart</TT></B>.
<P>
</BODY></HTML>
